package com.weifly.egp.util;

import java.math.BigDecimal;

/**
 * Created by weijianxin on 2018/11/11.
 */
public class EgpUtils {

    /**
     * 浮点数相加
     *
     * @param val1
     * @param val2
     * @return
     */
    public static Double addValue(Double val1, Double val2){
        BigDecimal b1 = new BigDecimal(val1.toString());
        BigDecimal b2 = new BigDecimal(val2.toString());
        return b1.add(b2).doubleValue();
    }

    /**
     * 浮点数相减
     *
     * @param val1
     * @param val2
     * @return
     */
    public static Double subtractValue(Double val1, Double val2){
        BigDecimal b1 = new BigDecimal(val1.toString());
        BigDecimal b2 = new BigDecimal(val2.toString());
        return b1.subtract(b2).doubleValue();
    }
}
